From a067938589d438957868fac10b941a475b11fadc Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 18 Jan 2023 19:55:31 +0100 Subject: [PATCH] gtkwindow: Minor refactor Move the handling of the startup ID to a separate function, since this will be called from several places. (cherry-picked from commit 6f01f846dc66a6359a1524ace13377536821dbb0) --- gtk/gtkwindow.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 5478e893eb..4e341f654b 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -6279,6 +6279,32 @@ popover_map (GtkWidget *widget, } } +static void +gtk_window_notify_startup (GtkWindow *window) +{ + GtkWindowPrivate *priv = window->priv; + + if (!disable_startup_notification && + !GTK_IS_OFFSCREEN_WINDOW (window) && + priv->type != GTK_WINDOW_POPUP) + { + /* Do we have a custom startup-notification id? */ + if (priv->startup_id != NULL) + { + /* Make sure we have a "real" id */ + if (!startup_id_is_fake (priv->startup_id)) + gdk_notify_startup_complete_with_id (priv->startup_id); + + g_free (priv->startup_id); + priv->startup_id = NULL; + } + else + { + gdk_notify_startup_complete (); + } + } +} + static void gtk_window_map (GtkWidget *widget) { @@ -6354,25 +6380,7 @@ gtk_window_map (GtkWidget *widget) gdk_window_show (gdk_window); - if (!disable_startup_notification && - !GTK_IS_OFFSCREEN_WINDOW (window) && - priv->type != GTK_WINDOW_POPUP) - { - /* Do we have a custom startup-notification id? */ - if (priv->startup_id != NULL) - { - /* Make sure we have a "real" id */ - if (!startup_id_is_fake (priv->startup_id)) - gdk_notify_startup_complete_with_id (priv->startup_id); - - g_free (priv->startup_id); - priv->startup_id = NULL; - } - else - { - gdk_notify_startup_complete (); - } - } + gtk_window_notify_startup (window); /* if mnemonics visible is not already set * (as in the case of popup menus), then hide mnemonics initially -- 2.39.5